package com.aidex.biz.service.impl;

import java.util.List;
import com.aidex.common.annotation.DataScope;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.domain.entity.SysUser;
import com.aidex.common.core.domain.entity.SysDept;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.framework.cache.DeptUtils;
import com.aidex.framework.cache.UserUtils;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.aidex.biz.mapper.ProductSkuMapper;
import com.aidex.biz.domain.ProductSku;
import com.aidex.biz.service.ProductSkuService;
import org.springframework.transaction.annotation.Transactional;
import com.aidex.common.utils.NumberUtils;

/**
 * 产品SKUService业务层处理
 * @author sean
 * @email 2074844820@qq.com
 * @date 2023-06-13
 */
@Service
@Transactional(readOnly = true)
public class ProductSkuServiceImpl extends BaseServiceImpl<ProductSkuMapper, ProductSku> implements ProductSkuService
{
    private static final Logger log = LoggerFactory.getLogger(ProductSkuServiceImpl.class);

    /**
     * 获取单条数据
     * @param productSku 产品SKU
     * @return 产品SKU
     */
    @Override
    public ProductSku get(ProductSku productSku)
    {
        ProductSku dto = super.get(productSku);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 产品SKUid
     * @return 产品SKU
     */
    @Override
    public ProductSku get(String id)
    {
        ProductSku dto = super.get(id);
        return dto;
    }


    /**
     * 查询产品SKU列表
     * @param productSku 产品SKU
     * @return 产品SKU
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public List<ProductSku> findList(ProductSku productSku)
    {
        return super.findList(productSku);
    }

    /**
     * 分页查询产品SKU列表
     * @param productSku 产品SKU
     * @return 产品SKU
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public PageInfo<ProductSku> findPage(ProductSku productSku)
    {
        return super.findPage(productSku);
    }

    /**
     * 保存产品SKU
     * @param productSku
     * @return 结果
     */
    @Override
    public boolean save(ProductSku productSku)
    {
        return super.save(productSku);
    }


    /**
     * 删除产品SKU信息
     * @param productSku
     * @return 结果
     */
    @Override
    public boolean remove(ProductSku productSku)
    {
        return super.remove(productSku);
    }

    /**
     * 批量删除产品SKU
     * @param ids 需要删除的产品SKUID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteProductSkuByIds(String[] ids)
    {
        return mapper.deleteProductSkuByIds(ids);
    }

    /**
     * 获取最大编号
     * @param productSku 产品SKU
     * @return 结果
     */
    @Override
    public int findMaxSort(ProductSku productSku)
    {
        return NumberUtils.nextOrder(mapper.findMaxSort(productSku));
    }
}
